package com.android.wlw_local.protocol;

import android.support.annotation.NonNull;

import com.google.gson.Gson;

/**
 * Created by zhuqin on 2018/3/5.
 */

public class ProtocolEntity {

    int type ;
    String value ;

    public ProtocolEntity(int type, String value) {
        this.type = type;
        this.value = value;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    /**
     * 封装Json
     * @param mProtocolEntity
     * @return
     */
    public static String toJsonStr(@NonNull ProtocolEntity mProtocolEntity){
        return new Gson().toJson(mProtocolEntity);
    }

    /**
     * 解析json
     * @param str
     * @return
     */
    public static ProtocolEntity praseEntity(String str){
        return new Gson().fromJson(str,ProtocolEntity.class);
    }
}
